<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class AdminUser extends Model
{
    //
    protected $table='admins';
    protected $adminModel;
    public $id;
    public $name;
    public $emil;
    public $mobile;
    public $password;
    public $login_total;
    public $login_ip;
    public $status;
    public $is_delete;
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->adminModel = DB::table($this->table);
    }
    public function getlist($params){
        if($params['getfield']){
            return  $this->adminModel->where($params['where'])->orderBy($params['order'])->select($params['field'])->get()->toArray();
        }else{
            return $this->adminModel->where($params['where'])->orderByDesc( $params['order'])->offset($params['page'])->limit($params['limit'])->get($params['field']);
        }
    }

}
